True if button b went down this frame or in any of the frames just before: btn_buffered(BTN_A, 6) is true for 6 frames after A was pressed. It makes a jump forgiving: if the player taps A a moment before landing, the jump still happens when they land.
Works differently on Game Boy - The Game Boy remembers a press for up to 32,767 frames, and it keeps watching the buttons from the first frame of the game.
Works differently on Game Boy Color - The Game Boy Color remembers a press for up to 32,767 frames, and it keeps watching the buttons from the first frame of the game.
On other consoles this differs: see Side by side and How the consoles differ.
btn_buffered(b, frames) -> bool| Name | Type |
|---|---|
b | button |
frames | int |
bool
True if button b went down this frame or in any of the frames frames just before. btn_buffered(BTN_A, 6) is true for six frames after A was pressed.
It makes a jump forgiving. If the player taps A a moment before landing, the jump still happens when they land, because the tap is remembered for a few frames.
if (btn_buffered(BTN_A, 6)) {
y -= 4;
}The walker jumps up 4 pixels if A was pressed in the last 6 frames.
frames of 0 means "this frame only", the same as btn_pressed.btn_buffered (or btn_held_frames), the engine starts watching every button once a frame. A press from before that first call is not known.One small job at the end of every frame once the game has asked.
Counted in frames (60 is about a second). frames of 0 means "this frame only", the same as btn_pressed. The first time any code calls this (or btn_held_frames), the engine starts watching every button once a frame, so a press from before that first call is not known. After you use the press, nothing clears it - the button stays "buffered" for the whole window - so use your own variable (set it to 0 when the jump starts) if one press must count once. A game that never calls it has nothing watching the buttons.